python handle exceptions in list comprehension